-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: skip comment blocks in DOCXToDocument
#8764
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
I left a few minor comments.
Please also add a release note, as explained here.
with LazyImport("Run 'pip install lxml'") as lxml_import: | ||
from lxml.etree import _Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with LazyImport("Run 'pip install lxml'") as lxml_import: | |
from lxml.etree import _Comment | |
from lxml.etree import _Comment |
Since lxml
is a dependency of python-docx
(see https://github.com/python-openxml/python-docx/blob/master/requirements.txt), we can safely put this import in the docx_import
lazy import block.
@@ -119,6 +121,7 @@ def __init__(self, table_format: Union[str, DOCXTableFormat] = DOCXTableFormat.C | |||
If False, only the file name is stored. | |||
""" | |||
docx_import.check() | |||
lxml_import.check() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lxml_import.check() |
if we incorporate the lxml
import in the docx lazy import block, we can remove this line.
Pull Request Test Coverage Report for Build 12922272483Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Related Issues
Proposed Changes:
issue: Loading issues with docx files saved using the latest version of WPS
solve: Added a judgment to skip invalid content
How did you test it?
Previous test code
no
Notes for the reviewer
@anakin87
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
and added!
in case the PR includes breaking changes.